home *** CD-ROM | disk | FTP | other *** search
- Path: news.mindlink.net!news
- From: genew@mindlink.bc.ca (Gene Wirchenko)
- Newsgroups: comp.lang.c
- Subject: Re: Logical exclusive-or
- Date: Fri, 16 Feb 1996 21:29:12 GMT
- Organization: MIND LINK! - British Columbia, Canada
- Message-ID: <4g2t3o$jp8@fountain.mindlink.net>
- References: <4f6lrq$bcr@lastactionhero.rs.itd.umich.edu> <4f7688$4te@beach.and.nl> <1996Feb14.115653.16697@friend.kastle.com>
- NNTP-Posting-Host: line137.nwm.mindlink.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- rich@kastle.com (Richard Krehbiel) wrote:
-
- >jos@and.nl (Jos A. Horsmeier) wrote:
-
- >>In article <4f6lrq$bcr@lastactionhero.rs.itd.umich.edu>, davidm@umich.edu
- >>wrote:
-
- >>|Is there a good reason why C doesn't have a logical exclusive-or
- >>|operator? A look at the precedence hierarchy suggests an obvious
- >>|symbol and precedence for such an operator:
-
- >>Note that although the logical 'and' and 'or' operators do not
- >>evaluate their right operand if their left operand is false or
- >>true resepectively, the 'logical exclusive or' operator must
- >>evaluate both operands no matter what the value of the left hand
- >>operand is. So the sole purpose of a '^^' operator would be a lexical
- >>shorthand for:
-
- >> a ^^ b == (!(a) != !(b))
-
- >>That wouldn't be much of added functionality, would it?
-
- >Well, it wouldn't be the first time that C offered more than one way
- >to do something...
-
- [examples snipped]
-
- >In all my C programming I have never encountered a place where I'd
- >have liked a logical exclusive-or. I don't think there's a need.
-
- Well, I have encountered such a place in my HLL programming: once
- or maybe twice. I don't think there's a need.
-
- >--
- >Richard Krehbiel, Kastle Systems, Arlington VA USA
- >rich@kastle.com (work) or richk@mnsinc.com (personal)
-
- Sincerely,
-
- Gene Wirchenko
-
- C Pronunciation Guide:
- y=x++; "wye equals ex plus plus semicolon"
- x=x++; "ex equals ex doublecross semicolon"
-
-